package com.demo2do.boyle.backend.service.report.impl;

import org.apache.poi.ss.formula.functions.T;
import org.springframework.stereotype.Service;

import com.demo2do.boyle.backend.service.report.AdvertisementDtoService;
import com.demo2do.boyle.common.entity.advertisement.Advertisement;
import com.demo2do.boyle.common.entity.advertisement.AdvertisementDto;
import com.demo2do.core.service.impl.GenericServiceImpl;

/**
 * 
 * @author Jason.Y
 */
@Service("advertisementDtoService")
public class AdvertisementDtoServiceImpl extends GenericServiceImpl<T> implements AdvertisementDtoService {
	
	@Override
	public AdvertisementDto loadById(Class<AdvertisementDto> class1, Integer advertisementId) {
		// TODO Auto-generated method stub
		
		AdvertisementDto advertisementDto = new AdvertisementDto();
		Advertisement advertisement = genericDaoSupport.load(Advertisement.class, advertisementId);
		
		advertisementDto.setAdTile(advertisement.getAdTitle());
		advertisementDto.setPutNumber(advertisement.getPutNumber());
		advertisementDto.setSocialTypeName(advertisement.getSocialType().getDescription());
		
		return advertisementDto;
	}
	
}
